<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
class Code_model extends CI_Model {
	public function __construct() {
		parent::__construct ();
	}
	/*
	 * 根据用户ID返回付款二维码信息
	 */
	public function find_by_user($userid){
		$this->db->where('userid', $userid);
		$query = $this->db->get('t_code');
		return $query->row_array();
	}
	/*
	 * 根据卡号返回付款二维码信息
	 */
	public function find_by_no($no){
		$this->db->where('no', $no);
		$query = $this->db->get('t_code');
		return $query->row_array();
	}
	/*
	 * 返回所有卡号信息
	 */
	public function find_all_code(){
		$query = $this->db->get('t_code');
		return $query->result_array();
	}
}